﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using AO.Core;

namespace ZoneEngine.Packets
{
    class WeaponItemFullUpdate
    {
        public static void UpdateWeaponsCache(Character ch)
        {
            int CurrentSlot = 64;

            while (CurrentSlot < 109)
            {
                
                CurrentSlot++;
            }
        }
        
        public static void SendOwner(Client cl, Character ch)
        {
            // ## ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ##
            // ## Weapon Item Full Update - Test ## Do Not attempt to send this packet until all values have been Verified ##
            // ## ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ##

            // notes: one packet has to be sent for each hand!!!!!!!
            // Packet only sent when Weapons are in Posession!

            PacketWriter PW = new PacketWriter();

            PW.PushByte(0xDF); // starter
            PW.PushByte(0xDF); // starter
            PW.PushShort(0xA);
            PW.PushShort(0x1);
            PW.PushShort(0); // Length
            PW.PushInt(3086); // Sender
            PW.PushInt(ch.ID); // Reciever
            PW.PushInt(0x3B1D2268); // Packet ID
            PW.PushInt(0xC74A); // .... Weapon maybe?
            PW.PushInt(0x45AEE789);// ID
            PW.PushByte(0);
            PW.PushInt(0xB);
            PW.PushInt(0xC350);
            PW.PushInt(ch.ID); // Reciever
            PW.PushInt(0xC0A);
            PW.PushInt(0xF424F);  // constant
            PW.PushShort(0);
            PW.PushInt(0x6); // Placement/Location Maybe?
            PW.PushInt(0x1F88); // Another Constant

            // Stat 1
            PW.PushInt(0); // constant Flags
            PW.PushUInt(0x403); // Item Flag
            // Stat 2
            PW.PushInt(0x17); // constant Static Instance?
            PW.PushInt(0x1e6d0); // Weapon ITEM ID
            // Stat 3
            PW.PushInt(0x2BD); //constant ACG Item Level
            PW.PushInt(0x5); // Quality-Level
            // Stat 4
            PW.PushInt(0x2BE); // constant ACGItemTemplateID
            PW.PushInt(0x1e6d0); // Weapon ITEM ID (low ID)
            // Stat 5
            PW.PushInt(0x2BF); // constant ACGItemTemplateID2
            PW.PushInt(0x1e6d1); // High ID
            // Stat 6
            PW.PushInt(0x19C); // Constant MultipleCount
            PW.PushInt(0x1); // Amount
            // Stat 7
            PW.PushInt(0x1A); // Constant Energy
            PW.PushUInt(0x28); // Ammo
            // End
            PW.PushInt(0); // Empty fill

            byte[] reply2 = PW.Finish();
            cl.SendCompressed(reply2);
        }

        public static void SendPlayfield(Client cl, Character ch)
        {
            // ## ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ##
            // ## Weapon Item Full Update - Test ## Do Not attempt to send this packet until all values have been Verified ##
            // ## ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ##

            // notes: one packet has to be sent for each hand!!!!!!!
            // Packet only sent when Weapons are in Posession!

            PacketWriter PW = new PacketWriter();

            PW.PushByte(0xDF); // starter
            PW.PushByte(0xDF); // starter
            PW.PushShort(0xA);
            PW.PushShort(0x1);
            PW.PushShort(0); // Length
            PW.PushInt(3086); // Sender
            PW.PushInt(ch.ID); // Reciever
            PW.PushInt(0x3B1D2268); // Packet ID
            PW.PushInt(0xC74A); // .... Weapon maybe?
            PW.PushInt(0x45AEE789);// ID
            PW.PushByte(0);
            PW.PushInt(0xB);
            PW.PushInt(0xC350);
            PW.PushInt(ch.ID); // Reciever
            PW.PushInt(0xC0A);
            PW.PushInt(0xF424F);  // constant
            PW.PushShort(0);
            PW.PushInt(0x6); // Placement/Location Maybe?
            PW.PushInt(0x1F88); // Another Constant

            // Stat 1
            PW.PushInt(0); // constant Flags
            PW.PushUInt(0x403); // Item Flag
            // Stat 2
            PW.PushInt(0x17); // constant Static Instance?
            PW.PushInt(0x1e6d0); // Weapon ITEM ID
            // Stat 3
            PW.PushInt(0x2BD); //constant ACG Item Level
            PW.PushInt(0x5); // Quality-Level
            // Stat 4
            PW.PushInt(0x2BE); // constant ACGItemTemplateID
            PW.PushInt(0x1e6d0); // Weapon ITEM ID (low ID)
            // Stat 5
            PW.PushInt(0x2BF); // constant ACGItemTemplateID2
            PW.PushInt(0x1e6d1); // High ID
            // Stat 6
            PW.PushInt(0x19C); // Constant MultipleCount
            PW.PushInt(0x1); // Amount
            // Stat 7
            PW.PushInt(0x1A); // Constant Energy
            PW.PushUInt(0x28); // Ammo
            // End
            PW.PushInt(0); // Empty fill

            byte[] reply = PW.Finish();
            cl.SendCompressed(reply);
        }
    }
}
